package com.msnjob.base;

import java.util.Enumeration;
import java.util.Map;
import javax.servlet.http.HttpServletRequest;
import org.apache.struts2.ServletActionContext;
import base.action.lib.BaseAction;
/**
 * 存储Action 常用信息
 * @author admin
 */
@SuppressWarnings("all")
public class MSNJobAction extends BaseAction implements java.io.Serializable  {
	
	//获取用户登录信息
	public Map getUserInfo(){
		HttpServletRequest request = ServletActionContext.getRequest();
		//清理会话
		//this.clearSession()
	   return (Map)request.getSession().getAttribute("user");
	}
	/**
	 * 登陆
	 * @return
	 * @throws Exception
	 */
	public String doLoginOut() throws Exception {
		HttpServletRequest request = ServletActionContext.getRequest();
		//清理会话
		//this.clearSession()
		request.getSession().setAttribute("user", null);
		Enumeration e = request.getSession().getAttributeNames();
		while (e.hasMoreElements()) {
			String sessionName = (String) e.nextElement();
			this.getSession().removeAttribute(sessionName);
		}
	 return "index";
	}
}
